package cn.inyaa.admin.sys.controller;

import cn.inyaa.admin.feign.InyaaSysFileFeign;
import com.inyaa.base.bean.BaseResult;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

@RestController
@RequestMapping("/file")
@RequiredArgsConstructor
public class InyaaSysFileController {

    private final InyaaSysFileFeign inyaaSysFileFeign;

    @PostMapping("/upload")
    public BaseResult<String> upload(@RequestParam("file") MultipartFile file, @RequestParam("type") Integer type) {
        return inyaaSysFileFeign.upload(file, type);
    }

    @PostMapping("/delete")
    public BaseResult<String> delete(@RequestParam("id") Integer id) {
        return inyaaSysFileFeign.delete(id);
    }

    @GetMapping("/list")
    public BaseResult<List<Object>> list() {
        return inyaaSysFileFeign.list();
    }
}
